// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_a.p_b;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.http.util.EncodingUtils;

public abstract class cls_a {

	public cls_a() {
	}

	public static long a(cls_a aa[]) {
		return a(aa, q);
	}

	public static long a(cls_a aa[], byte abyte0[]) {
		long l2 = 0;
		long l3 = 0;
		int i1 = 0;
		long l1 = 0;
		if (aa == null)
			throw new IllegalArgumentException("Parts may not be null");
		i1 = 0;
		l1 = 0L;
		while (true) {

			if (i1 >= aa.length)
				break;
			aa[i1].a(abyte0);
			try {
				l3 = aa[i1].i();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			if (l3 >= 0L) {
				l1 += l3;
				i1++;

			} else {
				l2 = -1L;
				return l2;
			}
		}
		l2 = l1 + (long) h.length + (long) abyte0.length + (long) h.length
				+ (long) d.length;
		return l2;

	}

	public static String a() {
		return "----------------314159265358979323846";
	}

	public static void a(OutputStream outputstream, cls_a aa[]) {
		try {
			a(outputstream, aa, q);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static void a(OutputStream outputstream, cls_a aa[], byte abyte0[]) throws IOException {
		if (aa == null)
			throw new IllegalArgumentException("Parts may not be null");
		if (abyte0 == null || abyte0.length == 0)
			throw new IllegalArgumentException("partBoundary may not be empty");
		for (int i1 = 0; i1 < aa.length; i1++) {
			aa[i1].a(abyte0);
			aa[i1].h(outputstream);
		}

		outputstream.write(h);
		outputstream.write(abyte0);
		outputstream.write(h);
		outputstream.write(d);
	}

	protected void a(OutputStream outputstream) throws IOException {
		outputstream.write(h);
		outputstream.write(f());
		outputstream.write(d);
	}

	void a(byte abyte0[]) {
		r = abyte0;
	}

	public abstract String b();

	protected void b(OutputStream outputstream) throws IOException {
		outputstream.write(j);
		outputstream.write(f);
		outputstream.write(EncodingUtils.getAsciiBytes(b()));
		outputstream.write(f);
	}

	public abstract String c();

	protected void c(OutputStream outputstream) throws IOException {
		String s = c();
		if (s != null) {
			outputstream.write(d);
			outputstream.write(l);
			outputstream.write(EncodingUtils.getAsciiBytes(s));
			String s1 = d();
			if (s1 != null) {
				outputstream.write(n);
				outputstream.write(EncodingUtils.getAsciiBytes(s1));
			}
		}
	}

	public abstract String d();

	protected void d(OutputStream outputstream) throws IOException {
		String s = e();
		if (s != null) {
			outputstream.write(d);
			outputstream.write(p);
			outputstream.write(EncodingUtils.getAsciiBytes(s));
		}
	}

	public abstract String e();

	protected void e(OutputStream outputstream) throws IOException {
		outputstream.write(d);
		outputstream.write(d);
	}

	protected  abstract  void f(OutputStream outputstream);

	protected byte[] f() {
		byte abyte0[];
		if (r == null)
			abyte0 = q;
		else
			abyte0 = r;
		return abyte0;
	}

	protected void g(OutputStream outputstream) throws IOException {
		outputstream.write(d);
	}

	public boolean g() {
		return true;
	}

	protected  abstract  long h();

	public void h(OutputStream outputstream) throws IOException {
		a(outputstream);
		b(outputstream);
		c(outputstream);
		d(outputstream);
		e(outputstream);
		f(outputstream);
		g(outputstream);
	}

	public long i() throws IOException {
		long l1;
		if (h() < 0L) {
			l1 = -1L;
		} else {
			ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
			a(bytearrayoutputstream);
			b(bytearrayoutputstream);
			c(bytearrayoutputstream);
			d(bytearrayoutputstream);
			e(bytearrayoutputstream);
			g(bytearrayoutputstream);
			l1 = (long) bytearrayoutputstream.size() + h();
		}
		return l1;
	}

	public String toString() {
		return b();
	}

	protected static final String a = "----------------314159265358979323846";
	protected static final byte b[];
	protected static final String c = "\r\n";
	protected static final byte d[] = EncodingUtils.getAsciiBytes("\r\n");
	protected static final String e = "\"";
	protected static final byte f[] = EncodingUtils.getAsciiBytes("\"");
	protected static final String g = "--";
	protected static final byte h[] = EncodingUtils.getAsciiBytes("--");
	protected static final String i = "Content-Disposition: form-data; name=";
	protected static final byte j[] = EncodingUtils
			.getAsciiBytes("Content-Disposition: form-data; name=");
	protected static final String k = "Content-Type: ";
	protected static final byte l[] = EncodingUtils
			.getAsciiBytes("Content-Type: ");
	protected static final String m = "; charset=";
	protected static final byte n[] = EncodingUtils.getAsciiBytes("; charset=");
	protected static final String o = "Content-Transfer-Encoding: ";
	protected static final byte p[] = EncodingUtils
			.getAsciiBytes("Content-Transfer-Encoding: ");
	private static final byte q[];
	private byte r[];

	static {
		b = EncodingUtils
				.getAsciiBytes("----------------314159265358979323846");
		q = b;
	}
}
